
package com.duobao.wuping;
import java.util.Vector;

import com.duobao.server.*;
public class Hunmi extends Equip implements Runnable//昏迷的人物
{
    private NPC npc;//昏迷的人物
    public Hunmi(String name,Vector ve,NPC npc)
    {
        super(15, name,name+"已经昏迷不醒了", 477, 477, 4, 0, 0,1,false);
        this.setJZH(0);
        this.setVe(ve);
        this.setJZB(0);
        this.setJZT(0);
        this.setFZ(1);

        this.npc=npc;
        this.npc.setHunmi(true);
    }
    public void setLocation(int location) {
        this.location = location;
        this.npc.setLocation(location);
    }
    public void shuxing()
    {
        this.npc.setHunmi(false);
        this.getVe().remove(this);
        System.out.println(this.npc.getName()+"苏醒了，位置在："+Maps.getMap(this.location).getMapName());
        Maps.getMap(this.location).getNpcs().add(this.npc);
    }
    public void siwang()
    {
        this.npc.setHunmi(false);
        //this.npc.setSiwang(true);
        this.getVe().remove(this);
    }
    public String sousheng(NPC npc1)//ncp1搜身
    {
        String str="";
        int size=npc.getEquip().size();
        for(int i=0;i<size;i++)
        {
            Equip  e=npc.getEquip().get(size-i-1);
            npc.getEquip().remove(e);
            e.setZB(false);
        }
        int size2=npc.getEquip2().size();
        for(int i=0;i<size2;i++)
        {
            Equip  e=npc.getEquip2().get(size2-i-1);
            str=str+"，"+e.getMsName();
            npc.getEquip2().remove(e);
            npc1.getEquip2().add(e);
        }
        return str;
    }

    public void run() {
        try {
            Thread.sleep(1000*60);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if(!this.npc.isSiwang())
        {
            this.shuxing();
        }

    }

}
